package com.yan.demo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo6 {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date();
        System.out.println(sdf.format(date));
        String bir = "2002-8-29";
        Date parse = sdf.parse(bir);
        String format = sdf.format(parse);
        System.out.println("format = " + format);
        System.out.println(parse.getTime());
    }
}
